edit_{$post_type}_per_page
Filter HookDescription
Filters the number of items per page to show for a specific 'per_page' type. The dynamic portion of the hook name, `$post_type`, refers to the post type. Possible hook names include: - `edit_post_per_page` - `edit_page_per_page` - `edit_attachment_per_page`Hook Information
File Location |
wp-admin/includes/post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1285 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$posts_per_page
|
Number of posts to display per page for the given post type. Default 20. |
Usage Examples
Basic Usage
<?php
// Hook into edit_{$post_type}_per_page
add_filter('edit_{$post_type}_per_page', 'my_custom_filter', 10, 1);
function my_custom_filter($posts_per_page) {
// Your custom filtering logic here
return $posts_per_page;
}
Source Code Context
wp-admin/includes/post.php:1285
- How this hook is used in WordPress core
<?php
1280 * @since 3.0.0
1281 *
1282 * @param int $posts_per_page Number of posts to display per page for the given post
1283 * type. Default 20.
1284 */
1285 $posts_per_page = apply_filters( "edit_{$post_type}_per_page", $posts_per_page );
1286
1287 /**
1288 * Filters the number of posts displayed per page when specifically listing "posts".
1289 *
1290 * @since 2.8.0
PHP Documentation
<?php
/**
* Filters the number of items per page to show for a specific 'per_page' type.
*
* The dynamic portion of the hook name, `$post_type`, refers to the post type.
*
* Possible hook names include:
*
* - `edit_post_per_page`
* - `edit_page_per_page`
* - `edit_attachment_per_page`
*
* @since 3.0.0
*
* @param int $posts_per_page Number of posts to display per page for the given post
* type. Default 20.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-admin/includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.